
<%@ page contentType="text/html; charset=UTF-8" language="java"
	errorPage=""%>

<%@ page import="java.util.Hashtable"%>

<%  response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 
response.setHeader("Pragma","no-cache"); //HTTP 1.0 
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
	
UserInfo user = null;


	if(session.getAttribute("userInfo")==null){
		response.sendRedirect(application.getInitParameter("loginUrl"));
		return;
	}else{
		
		
		
		user = (UserInfo)session.getAttribute("userInfo");
		
		if("18".equals(user.getLoginType())){
			out.println("<script type='text/javascript'>");
			out.println("alert('尊敬的客户,很抱歉,暂不支持随机码登陆方式的用户订购增值业务');");
			out.println("window.history.go(-1)");
			out.println("</script>");
			return;
		}
		if(!("50".equals(user.getLoginType()))&&user.getLinkedAccnbr().size()==0){
			out.println("<script type='text/javascript'>");
			out.println("alert('尊敬的客户,很抱歉,你当前登陆的号码下还未绑定手机号码');");
			out.println("window.history.go(-1)");
			out.println("</script>");
			return;
		}
	}
	 	

	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@page import="com.doone.telmarket.domain.UserInfo"%>
<%@page import="java.util.List"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>增值业务超市 - 语音及短信增值业务 - 我的订购</title>
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/style_link.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/tab.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/js/jquery.js"
	type="text/javascript"></script>
<script
	src="${pageContext.request.contextPath}/js/jquery.ui.draggable.js"
	type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.alerts.js"
	type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ajaxfileupload.js"
	type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/common.js"
	type="text/javascript"></script>
<link href="${pageContext.request.contextPath}/css/jquery.alerts.css"
	rel="stylesheet" type="text/css" media="screen" />
<style type="text/css">
<!--
.baibai {
	color: #FFF;
}
-->
</style>

<script type="text/javascript">
  window.onload = function(){
	  queryValueAdded();
	}

	function changeNbr(){
		queryValueAdded();
	}

	function cancelValueAdded(productid,businame,node){
		jConfirm('您确定要退订'+businame+'业务吗?确认请点击\"OK\"按钮,放弃退订请点击\"Cancel\"按钮。', '确认对话框', function(r) {
			if(r){
				var contextPath = $("#contextPath").val();
				var selectedNbr = $("#selectNbr").val();
				var url = contextPath +'/web/cancelValueAddedAjax';
				$.ajax({
				    url: url,
				    type: 'POST',
				    data: "productid="+productid+"&orderMode=ISM"+"&businame="+businame+"&accessNumber="+selectedNbr,
				    timeout: 15000,
				    error: function(){
				        jAlert('请求服务错误','消息');
				    },
				    success: function(msg){
				        eval('var obj='+msg);
				        if(obj.resultCode=="0"){
				        	document.getElementById("serviceTable").deleteRow(node.parentNode.parentNode.rowIndex);
						}
				        jAlert("操作结果"+obj.message,'消息');
				    }
				});
			}
		});
	}

	function queryValueAdded(){
		var tab = document.getElementById("serviceTable");
		while(tab.rows.length>1){
	    	   tab.deleteRow(1);
		}
		var otr = tab.insertRow(-1);
		var ntd1 = document.createElement("<td height='30' colspan='5' align='center' valign='middle' bgcolor='#FFF4F4'>");
		ntd1.innerHTML = "正在查询中,请您稍候...";
		otr.appendChild(ntd1);
		otr = tab.insertRow(-1);
		ntd1 = document.createElement("<td height='30' colspan='5' align='center' valign='middle' bgcolor='#FFF4F4'>");
		ntd1.innerHTML = "提醒：部分合作SP业务退订不包含在内，具体退订方式咨询在线客服";
		otr.appendChild(ntd1);
	
		
		var contextPath = $("#contextPath").val();
		var selectedNbr = $("#selectNbr").val();
		var url = contextPath +'/web/queryValueAdded';
		$.ajax  
	    (   
	        {   
	            url:url,    
	            type: 'POST',
	            data: "accessNumber="+selectedNbr+"&orderMode=ISM",
	            timeout:15000,
	            success: function(msg)   
	            {
	        	   eval('var obj='+msg);
	        	   var proList = obj.serviceProductList;

			       while(tab.rows.length>1){
			    	   tab.deleteRow(1);
					      }
				   if(proList.length>0){
					   for(var z=0;z<proList.length;z++){
							var otr = tab.insertRow(-1);
			    	        var otd1 = document.createElement("<td height='30' align='center' bgcolor='#FFF4F4'>");

			    	        var otd2 = document.createElement("<td height='30' align='center' bgcolor='#FFF4F4'>");
			    	        var otd3 = document.createElement("<td height='30' align='center' bgcolor='#FFF4F4'>");
			    	        var otd4 = document.createElement("<td height='30' align='center' bgcolor='#FFF4F4'>");
			    	        var img = document.createElement("<img src='${pageContext.request.contextPath}/images/bnt_td.gif' width='44' height='20' style='cursor: hand' onClick=cancelValueAdded('"+proList[z].productId+"','"+proList[z].productName+"',this) />");                                   
			    	        var otd5 = document.createElement("<td height='30' width='18%' align='center' valign='middle' bgcolor='#FFF4F4'>");
			    	        otd1.innerHTML = proList[z].productName;
			    	        otd2.innerHTML = proList[z].service.spName;
			    	        otd3.innerHTML = (proList[z].cost)/100+"元";
			    	        otd4.innerHTML = "已开通";
			    	        otd5.appendChild(img);
			    	        otr.appendChild(otd1); 
			    	        otr.appendChild(otd2); 
			    	        otr.appendChild(otd3); 
			    	        otr.appendChild(otd4); 
			    	        otr.appendChild(otd5);
						}
					}else{
						var otr = tab.insertRow(-1);
					    var ntd1 = document.createElement("<td height='30' colspan='5' align='center' valign='middle' bgcolor='#FFF4F4'>");
					    ntd1.innerHTML = "尊敬的客户,你还没有已订购增值业务";
						otr.appendChild(ntd1);
					}

				   var otr = tab.insertRow(-1);
				   var ntd1 = document.createElement("<td height='30' colspan='5' align='center' valign='middle' bgcolor='#FFF4F4'>");
				   ntd1.innerHTML = "提醒：部分合作SP业务退订不包含在内，具体退订方式咨询在线客服";
				   otr.appendChild(ntd1);
	        	     
	            },   
	            error: function (msg)   
	            {   
	            	jAlert('获取订购信息失败','消息');
	            }   
	        }   
	    );  
	}


</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td><input id="contextPath" type="hidden" value="${pageContext.request.contextPath}" /><a name="TOP" id="gongneng5"></a> <iframe
			src="${pageContext.request.contextPath}/web/common/head.jsp"
			width="100%" height="267" scrolling="no" frameborder="0"></iframe></td>
	</tr>
</table>
<table width="987" border="0" cellpadding="0" cellspacing="0"
	style="margin-bottom: 8px;">
	<tr>
		<td height="16" align="left" valign="middle" class="huise_12">&nbsp;<a
			href="${pageContext.request.contextPath}/web/index.htm">超市首页</a> &gt;&nbsp;我的增值业务</td>
	</tr>
</table>
<table width="987" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="774" align="left" valign="top">
		<table width="769" height="26" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td width="10"><img src="${pageContext.request.contextPath}/images/list/index_2.gif" width="10"
					height="30" /></td>
				<td width="753" background="${pageContext.request.contextPath}/images/list/index_3.gif">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="10" align="center" valign="middle" class="baise_14"><img
							src="${pageContext.request.contextPath}/images/lm_01.gif" width="10" height="30" /></td>
						<td width="115" align="center" valign="middle"
							background="${pageContext.request.contextPath}/images/lm_03.gif" class="baise_14"
							style="padding-top: 2px;">我的增值业务</td>
						<td width="10" height="30" align="center" valign="middle"
							class="baise_14"><img src="${pageContext.request.contextPath}/images/lm_02.gif" width="10"
							height="30" /></td>
						<td width="614" height="30" align="left" valign="bottom">&nbsp;</td>
					</tr>
				</table>
				</td>
				<td width="10" align="right"><img src="${pageContext.request.contextPath}/images/list/index_4.gif"
					width="10" height="30" /></td>
			</tr>
		</table>
		<table width="769" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td height="275" align="center" valign="top"
					style="border-left: 1px solid #c2282a; border-right: 1px solid #c2282a;">
				<table width="100%" height="18" border="0" cellpadding="0"
					cellspacing="0">
					<tr>
						<td height="18">&nbsp;</td>
					</tr>
				</table>
				<table width="723" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="24" align="left" valign="middle"
							background="${pageContext.request.contextPath}/images/list/index_7.gif">
						<table width="715" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="10" align="right" valign="middle">&nbsp;</td>
								<td width="638" align="left" class="heise_B_12">已订增值业务</td>
								<td width="67" align="center" valign="middle" class="huise_12">&nbsp;</td>
							</tr>
						</table>
						</td>
					</tr>
					<tr>
						<td width="723" height="133" align="center" valign="middle">
						<table width="723" height="137" border="0" cellpadding="0"
							cellspacing="0">
							<tr>
								<td align="center" valign="top">
								<table width="500" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="105" height="40" align="left">请选择产品号</td>
										<td width="527" align="left">
										<select id="selectNbr" onchange="changeNbr();">
  		<%
  		
  			if("50".equals(user.getLoginType())){
  				%>
  				<option value="<%=user.getAccnbr() %>"><%=user.getAccnbr() %></option>
  				<%
  			}else{
  				List<String> linkedNbr = user.getLinkedAccnbr();
  				for(int i=0;i<linkedNbr.size();i++){
  					%>
  	  				<option value="<%=linkedNbr.get(i) %>"><%=linkedNbr.get(i) %></option>
  	  				<%
  				}
  			}
  		%>
  		
  		</select>
										</td>
									</tr>
								</table>
								<br />
								<div id="dispa" align="center" >
								<table width="500" border="0" cellpadding="0" cellspacing="1" id="serviceTable"
									bgcolor="#EA3337">
									<tr class="baibai">
										<td width="143" height="30" align="center" bgcolor="#EA5357"
											class="baibai"><strong>业务名称</strong></td>
										<td width="184" align="center" bgcolor="#EA5357"
											class="baibai"><strong class="Bai_12">服务提供商</strong></td>
										<td width="131" align="center" bgcolor="#EA5357"
											class="baibai"><strong>功能使用费</strong></td>
										<td width="83" align="center" bgcolor="#EA5357" class="baibai"><strong>状态</strong></td>
										<td width="91" align="center" bgcolor="#EA5357" class="baibai"><strong>操作</strong></td>
									</tr>
									
									<tr>
										<td height="30" colspan="5" align="center" valign="middle"
											bgcolor="#FFF4F4">
										<table border="0" cellspacing="0" cellpadding="0">
											<tr>
											<td>
											<table border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="388" align="right">
												提醒：部分合作SP业务退订不包含在内，具体退订方式咨询在线客服</td>
											</tr>
										</table>
												</td>
											</tr>
										</table>
										</td>
									</tr>
								</table>
								</div>
								
								<br />
								<br />
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		<table width="769" border="0" cellspacing="0" cellpadding="0"
			style="margin-bottom: 8px;">
			<tr>
				<td width="10"><img src="${pageContext.request.contextPath}/images/tab_foot_1.gif" width="10"
					height="6" /></td>
				<td width="749" background="${pageContext.request.contextPath}/images/tab_foot_2.gif"></td>
				<td width="10"><img src="${pageContext.request.contextPath}/images/tab_foot_3.gif" width="10"
					height="6" /></td>
			</tr>
			<tr></tr>
		</table>
		</td>
		<td width="213" align="right" valign="top">
		<iframe src="${pageContext.request.contextPath}/web/common/activity.html" width="100%"  height="317px"  frameborder="0"  marginwidth="0" marginheight="0"  scrolling="no"></iframe>
		</td>
	</tr>
</table>
<table width="986" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td><iframe
			src="${pageContext.request.contextPath}/web/common/footer.html"
			width="986" height="159" scrolling="no" frameborder="0"></iframe></td>
	</tr>
</table>
</body>
</html>
